Upgrade Rails from 7.2 to 8.0#6955
Conversation
|
cooollll :) |
This extra require was added on the latest rails upgrade but it's not necessary anymore.
4d12204 to
c5af932
Compare
5eb704c to
d37e734
Compare
|
|
||
| foreman start -f Procfile.dev "$@" | ||
| #!/usr/bin/env ruby | ||
| exec "./bin/rails", "server", *ARGV |
There was a problem hiding this comment.
I tested things locally and this seems fine. Could someone try it out and see if it's best to keep the previous changes?
| # If set to `:zone`, `to_time` methods will use the timezone of their receivers. | ||
| # If set to `:offset`, `to_time` methods will use the UTC offset. | ||
| # If `false`, `to_time` methods will convert to the local system UTC offset instead. | ||
| #++ |
There was a problem hiding this comment.
The new defaults look okay to be enabled altogether...
| end | ||
| end | ||
| resources :reimbursements, only: %i[index change_complete_status], concerns: %i[with_datatable] do | ||
| resources :reimbursements, only: %i[index], concerns: %i[with_datatable] do |
There was a problem hiding this comment.
I tested the removed routes and they work as expected.
| @@ -1,6 +1,4 @@ | |||
| require "rails_helper" | |||
| # require "contact_type_group" | |||
There was a problem hiding this comment.
This was left here from the previous upgrade, but it's not necessary anymore.
| it "raises RoutingError if no step in url" do | ||
| expect { patch "/case_contacts/#{case_contact.id}/form", params: {case_contact: attributes} } | ||
| .to raise_error(ActionController::RoutingError) | ||
| it "responds with 404 if no step in url" do |
There was a problem hiding this comment.
I couldn't find out exactly where this changed in the release notes for this Rails version but I imagine it's a good change since it shows the new 404 page instead of raising a server error.
|
@compwron could you test this branch locally and in staging as well? I want to make sure I am not introducing anything that I couldn't test locally. Thanks! |
|
very cool, will do |
annotate is unmaintained and pinned < 8.0, so bundler walked back ~7 years to find a Rails-8-compatible |
Ah, thanks for catching that! Since it's not compatible and it's a dev dependency that is not critical, I would propose removing |
|
Actually, I created #6962 to replace |
|
Followups:
|
|
Very cool :) #6962 is now merged! |
|
thanks @compwron this is now ready for local/staging QA 🎉 |
| gem install foreman | ||
| fi | ||
|
|
||
| foreman start -f Procfile.dev "$@" |
There was a problem hiding this comment.
We need the procfile for local and remote deployment, add this back? https://github.com/rubyforgood/casa/blob/main/Procfile
There was a problem hiding this comment.
Sounds good! I reverted it back in 32121eb
| # explicit rubocop config increases performance slightly while avoiding config confusion. | ||
| ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__)) | ||
|
|
||
| load Gem.bin_path("rubocop", "rubocop") |
There was a problem hiding this comment.
This codebase uses standardrb not rubocop
There was a problem hiding this comment.
Pull request overview
Upgrades the CASA Rails application from Rails 7.2 to Rails 8.0, incorporating the Rails 8-generated configuration defaults and aligning routes, error pages, and tests with updated framework behavior.
Changes:
- Bump Rails to
~> 8.0and updateGemfile.lock/db/schema.rbaccordingly. - Refresh Rails environment config (dev/test/prod), Puma config, and add
new_framework_defaults_8_0.rb. - Update public error pages and adjust routing/tests to reflect Rails 8 exception/rendering behavior.
Reviewed changes
Copilot reviewed 16 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/requests/case_contacts/form_spec.rb | Updates request spec expectation from raising to 404 response. |
| spec/models/contact_type_group_spec.rb | Removes explicit model require (leans on Rails autoloading). |
| public/icon.svg | Updates default icon SVG shape/size. |
| public/422.html | Replaces legacy 422 page with Rails 8 generated page. |
| public/406-unsupported-browser.html | Replaces legacy 406 page with Rails 8 generated page. |
| public/400.html | Adds Rails 8 generated 400 error page. |
| Gemfile.lock | Locks Rails 8.0.x and associated dependency updates. |
| Gemfile | Bumps Rails requirement to ~> 8.0. |
| doc/DOCKER.md | Removes webpack dev server guidance. |
| db/schema.rb | Updates schema version to 8.0 and adjusts extension name output. |
| config/routes.rb | Adjusts only/except usage to comply with Rails 8 routing constraints. |
| config/puma.rb | Adds optional Solid Queue Puma plugin hook and refreshes comments. |
| config/initializers/new_framework_defaults_8_0.rb | Adds Rails 8 framework defaults initializer and enables settings. |
| config/initializers/filter_parameter_logging.rb | Expands filtered parameter list (e.g., email/card fields). |
| config/initializers/assets.rb | Removes older precompile comment block. |
| config/environments/test.rb | Updates test environment settings, including exception rendering behavior. |
| config/environments/production.rb | Refreshes production config to closer match Rails 8 generated defaults. |
| config/environments/development.rb | Refreshes development config to closer match Rails 8 generated defaults. |
| bin/setup | Adjusts command runner behavior in setup script. |
| bin/rubocop | Adds a rubocop binstub wrapper. |
| bin/dev | Changes dev launcher behavior (now only starts Rails server). |
The Procfile is used for local and remote deployment
What github issue is this PR for, if any?
Closes #6925
What changed, and why?
Rails 8.0 was released in late 2024 and brings Solid Queue / Solid Cache / Solid Cable as defaults, Propshaft, Kamal 2, Authentication generator, and a number of framework deprecations.
Most notable changes:
onlyandexceptfor non-RESTful routes: c64228aconfig/environmentswith the generated files as much as possibleconfig/initializers/new_framework_defaults_8_0.rblook okay to be enabled altogether but if you prefer to enable them individually, let me know.How is this tested? (please write rspec and jest tests!) 💖💪
Followups
config.load_defaultsto 8.0. It should fix this deprecation warning: "DEPRECATION WARNING:to_timewill always preserve the full timezone rather than offset of the receiver in Rails 8.1. To opt in to the new behavior, setconfig.active_support.to_time_preserves_timezone = :zone. (called from <top (required)> at /home/runner/work/casa/casa/config/environment.rb:5)"Questions
Is it possible to test this on staging/QA first? Please try this out locally and let me know if you run into any issues.